﻿Public Class ucStatusBar
  Public Sub MostrarMensaje(ByVal pMensaje As String, ByVal pColorFondo As Color, ByVal pColorLetra As Color, Optional ByVal pTiempoDisplay As Integer = 2000, Optional ByVal pSonido As Media.SystemSound = Nothing)
    Me.Visible = True
    With sbBarra
      .Text = pMensaje
      .Appearance.BackColor = pColorFondo
      .Appearance.ForeColor = pColorLetra
      .Visible = True
      .Panels("Mensaje").Text = pMensaje
    End With
    With tBarValidacion
      .Enabled = True
      .Interval = pTiempoDisplay
    End With
    If pSonido IsNot Nothing Then
      pSonido.Play()
    End If
  End Sub

  Public Sub MostrarMensajeVerde(pMensaje As String)
    MostrarMensaje(pMensaje, Color.Green, Color.White, 3000)
  End Sub

  Public Sub MostrarMensajeRojo(pMensaje As String)
    MostrarMensaje(pMensaje, Color.Red, Color.White, 3000, Media.SystemSounds.Exclamation)
  End Sub

  Private Sub tBarValidacion_Tick(sender As Object, e As System.EventArgs) Handles tBarValidacion.Tick
    sbBarra.Visible = False
    Me.Visible = False

  End Sub

  Private Sub sbBarra_ButtonClick(sender As Object, e As Infragistics.Win.UltraWinStatusBar.PanelEventArgs) Handles sbBarra.ButtonClick
    Me.Visible = False
    tBarValidacion.Enabled = False
  End Sub

  Private Sub ucStatusBar_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Me.Visible = False
  End Sub
End Class
